# coding=utf-8
import timeit

def print_time(func):
    def _inner(request, *args, **kwargs):
        print 'Time Used:', timeit.timeit('%s' % func.__name__,
                            'from __main__ import %s' % func.__name__)
        return func(request, *args, **kwargs)
        
    return _inner
    
@print_time
def dosomething(n=10):
    sum = 0
    for i in xrange(n):
        sum += i
    return sum
    
if __name__ == '__main__':
    sum = dosomething(200)
    print 'sum=', sum
